package com.dq.oss.controller;

import com.dq.commonutils.vo.Result;
import com.dq.oss.service.OssService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.HashMap;
import java.util.Map;

/**
 * @project: guli_parent
 * @ClassName: OssController
 * @author: dq
 * @creat: 2022/7/20 11:07
 */
@RestController
@RequestMapping("eduoss/fileoss")
// @CrossOrigin
public class OssController {

    @Autowired
    private OssService ossService;

    /**
     * 添加阿里云视频
     * @param file
     * @return
     */
    @PostMapping("upload")
    public Result uploadFile(MultipartFile file){
        //获取上传文件
        String resultUrl = ossService.uploadFileAvatar(file);
        Map<String, String> map = new HashMap<>();
        map.put("picUrl",resultUrl);
        return Result.success(map);
    }


}
